/*
 * TipoDespesaBusinessDelegate.java
 *
 * Created on 10 de Julho de 2007, 15:01
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package br.unifor.finance.presentation.delegate;

import br.unifor.finance.common.business.entity.TipoDespesa;
import br.unifor.finance.common.business.service.TipoDespesaService;
import br.unifor.finance.common.dto.PersistentObject;
import br.unifor.finance.presentation.delegate.exceptions.BusinessDelegateException;
import br.unifor.finance.presentation.servicelocator.ServiceLocator;
import java.util.Collection;

/**
 *
 * @author Clebernaice, Cleilson, Leonardo
 * @version 1.0, 29/05/2007.
 */

public class TipoDespesaBusinessDelegate
        extends AbstractBusinessDelegate<TipoDespesa, Integer> {

  private static TipoDespesaBusinessDelegate instance;
  
  private ServiceLocator locator = ServiceLocator.getInstance();
  private TipoDespesaService service = locator.lookupTipoDespesaService();
  
  /** Creates a new instance of TipoDespesaBusinessDelegate */
  private TipoDespesaBusinessDelegate() {

  }
  
  public static TipoDespesaBusinessDelegate getInstance() {
    if (instance == null)
      instance = new TipoDespesaBusinessDelegate();
    
    return instance;
  }

  public String getJndiName() {
    return null;
  }
  
  public Collection<TipoDespesa> findAll() throws BusinessDelegateException {
    return service.findAll();
  }
  
  public Integer insert(TipoDespesa tipoDespesa) throws BusinessDelegateException {
    return service.insert(tipoDespesa);
  }  

  public TipoDespesa findById(Integer id) throws BusinessDelegateException {
    return service.findById(id);
  }
  
  public void update(TipoDespesa tipoDespesa) throws BusinessDelegateException {
    service.update(tipoDespesa);
  }
  
  public void delete(TipoDespesa tipoDespesa) throws BusinessDelegateException {
    service.delete(tipoDespesa);
  }
}
